package cn.HuanG.org.service.impl;

import cn.HuanG.base.service.impl.BaseServiceImpl;
import cn.HuanG.org.domain.Employee;
import cn.HuanG.org.mapper.EmployeeMapper;
import cn.HuanG.org.query.EmployeeQuery;
import cn.HuanG.org.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 员工表的实现类
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Long count(EmployeeQuery employeeQuery) {
        return employeeMapper.count(employeeQuery);
    }

    @Override
    public List<Employee> queryDate(EmployeeQuery employeeQuery) {
        return employeeMapper.queryDate(employeeQuery);
    }

    @Override
    @Transactional
    public void batchDel(Long[] ids) {
        employeeMapper.batchDel(ids);
    }

    @Override
    public void active(Long id) {
        Employee employee = employeeMapper.queryById(id);
        System.out.println("急啊急啊："+employee);
        employee.setState(1);
        employeeMapper.update(employee);
    }


}
